package io.github.harmonly.service.impl;

import io.github.harmonly.entity.activity.Participant;
import io.github.harmonly.mapper.ParticipantMapper;
import io.github.harmonly.service.ParticipantService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ParticipantServiceImpl implements ParticipantService {

    @Resource
    private ParticipantMapper mapper;

    @Override
    public List<Participant> getParticipants() {
        return mapper.getParticipants();
    }

    @Override
    public List<Participant> getParticipantByActivity(int cid) {
        return mapper.getParticipantByActivity(cid);
    }

    @Override
    public List<Participant> getParticipantByUser(int uid) {
        return mapper.getParticipantByUser(uid);
    }

    @Override
    public boolean addParticipant(Participant participant) {
        return mapper.addParticipant(participant) == 1;
    }

    @Override
    public boolean deleteParticipant(Participant participant) {
        return mapper.deleteParticipant(participant) == 1;
    }

    @Override
    public boolean isJoin(Participant participant) {
        return mapper.isJoin(participant) != null;
    }
}
